home *** CD-ROM | disk | FTP | other *** search
- Path: erich.triumf.ca!bennett
- From: bennett@erich.triumf.ca (P.Bennett)
- Newsgroups: comp.lang.c
- Subject: Re: HELP: Illegal Pointer Arithmetic
- Date: 22 Feb 1996 23:04 PST
- Organization: TRIUMF: Tri-University Meson Facility
- Distribution: world
- Message-ID: <22FEB199623041372@erich.triumf.ca>
- References: <4gj0ug$730@news.one.net>
- NNTP-Posting-Host: erich.triumf.ca
- News-Software: VAX/VMS VNEWS 1.50
-
- In article <4gj0ug$730@news.one.net>, Oren Levin <oren@one.net> writes...
- >The following code is giving me a "illegal pointer arithmetic" error.
- >I'm trying to strip the carrage return off of a line of text read from a
- >file.
- >
- > /* get rid of the trailing carrage return */
- > buffer [strlen (buffer) - 1] = "\0";
-
- try
- buffer[strlen(buffer)-1] = '\0'
-
- "\0" is a string (a very peculiar one, but still a string) consisting of the
- zero byte you specify, plus the usual zero byte that terminates C strings. '\0'
- is a single character.
-
-
- Peter Bennett VE7CEI | Vessels shall be deemed to be in sight
- Internet: bennett@triumf.ca | of one another only when one can be
- Packet: ve7cei@ve7kit.#vanc.bc.ca | observed visually from the other
- TRIUMF, Vancouver, B.C., Canada | ColRegs 3(k)
- GPS and NMEA info and programs: ftp://sundae.triumf.ca/pub/peter/index.html
-
-